<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-model</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  <h1>v-model</h1>
  <hr>
  <div id="app">
    <p>{{message}}</p>
    <h3>文本框</h3>
    <p>v-model:<input type="text" v-model="message"></p>
    <p>v-model.lazy:<input type="text" v-model.lazy="message"></p>
    <p>v-model.number:<input type="text" v-model.number="message"></p>
    <p>v-model.trim:<input type="text" v-model.trim="message"></p>
    <hr>
    <h3>文本域</h3>
    <textarea name="t1" id="tt1" cols="30" rows="10" v-model="message"></textarea>
    <hr>
    <h3>多选框绑定一个值</h3>
    <input type="checkbox" id="isTrue" v-model="isTrue">
    <label for="isTrue">{{isTrue}}</label>
    <hr>
    <h3>多选框绑定数组</h3>
    <p>
      <input type="checkbox" id="isAdam" value="Adam" v-model="webNames">
      <label for="isAdam">Adam</label>
      <input type="checkbox" id="isTom" value="Tom" v-model="webNames">
      <label for="isTom">Tom</label>
      <input type="checkbox" id="isLi" value="Li" v-model="webNames">
      <label for="isLi">Li</label>
    </p>
    <p>{{webNames}}</p>
    <hr>
    <h3>单选框绑定</h3>
    <p>
      <input type="radio" id="radio1" value="男" v-model="sex">
      <label for="radio1">男</label>
      <input type="radio" id="radio2" value="女" v-model="sex">
      <label for="radio2">女</label>
      <p>你选择的性别是：{{sex}}</p>
    </p>
  </div>
  <script type="text/javascript">
  var app = new Vue({
    el:'#app',
    data:{
      message:'hello world!',
      isTrue:true,
      webNames:[],
      sex:''
    }
  })
  </script>
</body>
</html>